<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>DBLINK管理</title>
<link rel="stylesheet" type="text/css" href="../../css/reset.css" />
<link rel="stylesheet" type="text/css" href="../../css/css.css" />
<link rel="stylesheet" type="text/css"
	href="../../js/jquery-easyui-1.4.3/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css"
	href="../../js/jquery-easyui-1.4.3/themes/icon.css" />
<link rel="stylesheet" type="text/css"
	href="../../js/SimpleTree1.3/js/tree_themes/SimpleTree.css" />
<link rel="stylesheet" type="text/css" href="../../css/colorReset.css" />
<style>
.sel_con label {
	width: 100px;
}

.public {
	display: none;
}

.template {
	display: none;
	padding: 0 0 10px 0;
}

.import_radio {
	margin: 10px auto;
	width: 220px;
}

.import_radio label {
	margin: 0 10px;
}

.database, template {
	margin: 10px 0;
}

.database .popup_con {
	width: 430px;
}

.database .popup_con ul {
	margin: 10px auto;
	width: 430px;
	overflow: hidden;
}

.database .popup_con ul li {
	width: 215px;
	display: block;
	float: left;
	height: 25px;
	overflow: hidden;
	padding: 5px 0;
}

.database .popup_con ul li.li_col {
	width: 430px;
	height: auto;
}

.database .popup_con .text {
	width: 120px;
	border: 1px solid #95B8E7;
	padding: 2px 3px;
	border-radius: 5px 5px 5px 5px;
}

.database .popup_con .label {
	width: 80px;
	text-align: right;
	display: block;
	float: left;
	line-height: 25px;
}

.database .popup_con .input_con {
	float: left;
}

.popup_con ul li.tns_li {
	padding: 0;
}

.tns_li .input_con p {
	padding: 2px 0;
}

#import_link {
	position: relative;
}

#progressbar {
	display: none;
	position: absolute;
	left: 0;
	bottom: 0;
	height: 100%;
	width: 100%;
	opacity: 0.6;
	filter: alpha(opacity = 60);
	background-color: #ffffff;
	/*background-color:#979797;*/
	z-index: 100;
}

#progressbar_tips {
	display: none;
	line-height: 30px;
	font-size: 16px;
	color: #000000;
	font-weight: bold;
	position: absolute;
	left: 0;
	bottom: 0;
	height: 100%;
	width: 100%;
	z-index: 101;
}

#progressbar_tips p {
	padding: 0 0 0 170px;
}

#progressbar_tips img {
	display: block;
	margin: 50px auto 0 auto;
	width: 50px
}
</style>
</head>

<body>
	<div class="main">
		<!-- 检索区域开始 -->
		<div class="sel_div">
			<table cellpadding="0" cellspacing="0" class="sel_con">
				<tr>
					<th colspan="5">数据检索</th>
				</tr>
				<tr>
					<td><label>所属领域：</label> <input type="text"
						name="comboxSearchfieldName" id="comboxSearchfieldName"
						class="text" /></td>
					<td><label>所属系统：</label> <input id="comboxSearchSystemName"
						name="comboxSearchSystemName" class="text" /></td>
					<td><label style="width: 85px;">源主机：</label><input
						id="txtSearchOwnerHost" name="txtSearchOwnerHost" class="text"
						data-options="required:true,validType:'host'"
						missingMessage="主机不能为空!" /></td>
					<td><label style="width: 85px;">DBLINK链接名：</label><input
						type="text" name="txtSearchDbLink" id="txtSearchDbLink"
						class="text" /></td>
					<td rowspan="1"><button onclick="search()"
							class="query_btn easyui-linkbutton" iconCls="icon-search">查询</button></td>
				</tr>
				<tr>
					<td><label>目标主机：</label><input id="txtSearchHost"
						name="txtSearchHost" class="text"
						data-options="required:true,validType:'host'"
						missingMessage="主机不能为空!" /></td>
					<td><label>源数据库实例名：</label><input type="text"
						name="txtSearchOwnerServiceName" id="txtSearchOwnerServiceName"
						class="text" /></td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>
						<button class="query_btn easyui-linkbutton" iconCls="icon-reset"
							onclick="onReset()">重置</button>
					</td>
				</tr>
			</table>
		</div>
		<!-- 检索区域结束 -->
		<!-- 
<div class="btn_all">
	<button>增加</button>
    <button>修改</button>
    <button>删除</button>
    <button>暂停/重启</button>
    <button>运行</button>
    <button>刷新</button>
</div> -->
		<div class="data_con">
			<div id="toolbox" style="padding: 5px; height: 25px">
				<div style="margin-bottom: 5px; float: left">
					<a href="javascript:void(0)" onclick="add()"
						class="easyui-linkbutton" id="toolbar_add" iconCls="icon-add"
						plain="true">新增</a> <a href="javascript:void(0)"
						onclick="update()" class="easyui-linkbutton" id="toolbar_modify"
						iconCls="icon-edit" plain="true">修改</a> <a
						href="javascript:void(0)" onclick="del()"
						class="easyui-linkbutton" id="toolbar_delete"
						iconCls="icon-remove" plain="true">刪除</a> <a
						href="javascript:void(0)" onclick="import_link()"
						class="easyui-linkbutton" id="toolbar_import" iconCls="icon-undo"
						plain="true">导入</a>
				</div>
			</div>
			<table id="datagrid" style="height: 345px"
				data-options="fitColumns:true,toolbar:'#toolbox'">
			</table>
		</div>
	</div>
	<!--main end-->
	<!--新增-->
	<div id="win" class="easyui-window" title="DBLINK管理-新增"
		style="width: 730px; height: auto;"
		data-options="iconCls:'icon-save',modal:true,minimizable:false,maximizable:false,collapsible:false">
		<form id="addForm" method="post">
			<!--源数据库-->
			<div class="popup_con">
				<h3>源数据库</h3>
				<ul>
					<li><label for="comboxFieldName" class="label">所属领域：</label>
						<div class="input_con">
							<input id="comboxFieldName" name="comboxFieldName" class="text" />
							<!--<input id="hiddenFieldName" name="hiddenFieldName"  class="easyui-validatebox text" data-options="required:true" missingMessage="所属领域不能为空!" style="position:absolute; z-index:-1; left:0; top:0"/>-->
						</div></li>
					<li><label for="comboxSystemName" class="label">系统名称：</label>
						<div class="input_con">
							<input type="text" name="comboxSystemName" id="comboxSystemName"
								class="text" />
						</div></li>
					<li><label for="txtDatabaseAddress" class="label">主机：</label>
						<div class="input_con">
							<input type="text" class="easyui-validatebox text"
								data-options="required:true,validType:'host'"
								missingMessage="主机不能为空!" id="txtDatabaseAddress"
								name="txtDatabaseAddress" style="width: 90px;" />
						</div> <label for="txtPort" class="label" style="width: 30px;">端口号：</label>
						<div class="input_con">
							<input type="text" value="1521" class="easyui-validatebox text"
								data-options="required:true,validType:'port'"
								missingMessage="端口号不能为空!" invalidMessage="端口号不得大于65535！"
								id="txtPort" name="txtPort" style="width: 30px;" />
						</div></li>
					<li><label for="txtOwnerServiceName" class="label">实例名：</label>
						<div class="input_con">
							<input type="text" class="easyui-validatebox text"
								data-options="required:true,validType:'length[0,50]'"
								missingMessage="实例名不能为空!" id="txtOwnerServiceName"
								name="txtOwnerServiceName" />
						</div></li>
					<li><label for="txtUser" class="label">所属用户：</label>
						<div class="input_con">
							<input type="text" class="easyui-validatebox text"
								data-options="required:true,validType:'length[0,50]'"
								missingMessage="所属用户不能为空!" id="txtUser" name="txtUser" /> <label
								class="publicbox"> <input type="checkbox" id="publics"
								class="tree-checkbox" name="publicRadio" value="3" /> Public
							</label>
						</div></li>
					<li><label for="txtDBLINKLinkName" class="label">DBLINK链接名：</label>
						<div class="input_con">
							<input type="text" class="easyui-validatebox text"
								data-options="required:true,validType:'length[0,50]'"
								missingMessage="DBlink链接名不能为空!" id="txtDBLINKLinkName"
								name="txtDBLINKLinkName" />
						</div></li>
				</ul>
			</div>
			<!--目标数据库-->
			<div class="popup_con">
				<h3>目标数据库</h3>
				<ul>
					<li><label for="txtTargetDatabaseAccount" class="label">目标库账号：</label>
						<div class="input_con">
							<input type="text" class="easyui-validatebox text"
								data-options="required:true,validType:'length[0,50]'"
								missingMessage="目标库账号不能为空!" id="txtTargetDatabaseAccount"
								name="txtTargetDatabaseAccount" />
						</div></li>
					<li><label for="txtTargetPassword" class="label">目标库密码：</label>
						<div class="input_con">
							<input type="password" class="easyui-validatebox text"
								data-options="required:true,validType:'length[0,50]'"
								missingMessage="目标库密码不能为空!" id="txtTargetPassword"
								name="txtTargetPassword" />
						</div></li>
					<li class="li_col"><label for="txtUser" class="label">数据库实例：</label>
						<div class="input_con">
							<div class="input_con_li">
								<label> <input id="tnsnames" type="radio"
									name="radioDatabaseInstance" value="0" />
									源数据库tnsnames.ora有目标数据库的映射配置&nbsp;<a href="javascript:void(0);"
									id="tips_img_open" class="tips">例子</a></label>
							</div>
							<div class="input_con_li">
								<label> <input id="nothing" type="radio"
									name="radioDatabaseInstance" checked="checked" value="1" />
									无映射配置
								</label>
							</div>
						</div></li>
					<li class="serviceName_li"><label for="txtServiceName"
						class="label">服务实例名：</label>
						<div class="input_con">
							<input type="text" class="easyui-validatebox text"
								data-options="required:true,validType:'length[0,50]'"
								disabled="disabled" missingMessage="服务实例名不能为空!"
								id="txtServiceName" name="txtServiceName" />
						</div></li>
					<li class="tns_li li_col"><label for="txtServiceName"
						class="label">TNS：</label>
						<div class="input_con">
							<p>(DESCRIPTION =</p>
							<p>
								(ADDRESS = (PROTOCOL = TCP)(HOST = <input type="text"
									class="easyui-validatebox text"
									data-options="required:true,validType:'host'"
									missingMessage="HOST不能为空!" name="host" id="host"
									style="width: 100px;" /> )(PORT= <input type="text"
									class="easyui-validatebox text"
									data-options="required:true,validType:'port'"
									missingMessage="PORT不能为空!" name="port" id="port" value="1521"
									style="width: 30px;" /> ))
							</p>
							<p>
								(CONNECT_DATA =(SERVER = DEDICATED) (SERVICE_NAME = <input
									type="text" class="easyui-validatebox text"
									data-options="required:true,validType:'length[0,50]'"
									missingMessage="服务名称不能为空!" name="serviceName" id="serviceName"
									style="width: 100px" /> )))
							</p>
						</div></li>
				</ul>
			</div>
		</form>
		<div id="buttons" class="button_con">
			<a href="javascript:void(0)" onclick="previewSQL()"
				class="easyui-linkbutton" id="" iconCls="icon-search" plain="true">预览SQL</a>
			<a href="javascript:void(0)" onclick="onCheckSave()"
				class="easyui-linkbutton" id="instance_save" iconCls="icon-ok"
				plain="true">保存</a> <a href="javascript:void(0)" onclick="rePage()"
				class="easyui-linkbutton" id="instance_cancel" iconCls="icon-cancel"
				plain="true">取消</a>
		</div>
	</div>
	<!--实例名提示-->
	<div id="tips_img" title=" ">
		<img src="../../images/u233.png" style="width: 450px;" alt="" />
	</div>

	<!--预览SQL-->
	<div id="tips_sql" class="tips_sql" title="预览SQL">
		<div id="sqlTxt" style="padding: 10px 30px 0 30px;">
			<p>
				-- Drop existing database link <br /> drop <span class="public">public</span>
				database link <span class="DBLINKLinkName" style="color: red"></span>
			</p>
			<p>
				-- Create database link <br /> create <span class="public">public</span>
				database link <span class="DBLINKLinkName" style="color: red"></span>
			</p>

			<p>
				connect to <span id="targetDatabaseAccount" style="color: red"></span>
				identified by <span id="targetPassword" style="color: red"></span>
			</p>
			<p class="using">
				using '<span id="serviceNameSql" style="color: red"></span>'
			</p>
			<p class="tns">
				using '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <span
					id="hostVal" style="color: red"></span> )(PORT= <span id="portVal"
					style="color: red"></span> )) (CONNECT_DATA =(SERVER = DEDICATED)
				(SERVICE_NAME = <span id="serviceNameVal" style="color: red"></span>)))';
			</p>
		</div>
		<div id="buttons_sql" class="button_con">
			<a href="javascript:void(0)" class="easyui-linkbutton saveSql" id=""
				iconCls="icon-ok" plain="true">复制</a> <a href="javascript:void(0)"
				class="easyui-linkbutton tips_sql_cal" id="" iconCls="icon-cancel"
				plain="true">取消</a>
		</div>
	</div>
	<!--导入-->
	<div id="import_link" title="导入">
		<div id="progressbar"></div>
		<div id="progressbar_tips">
			<img src="../../images/progressbar.gif" alt="" />
			<p>
				读取中，请稍候<span id="progressbar_point"></span>
			</p>
		</div>
		<div class="import_radio">
			<label for="database_radio"><input type="radio"
				checked="checked" value="1" name="import_radio" id="database_radio" />从数据库导入</label>
			<label for="template_radio"><input type="radio"
				name="import_radio" value="2" id="template_radio" />从模板导入</label>
		</div>
		<div class="database">
			<div class="popup_con">
				<form id="importForm" method="post">
					<ul>

						<li><label for="importDatabaseAddress" class="label">源主机：</label>
							<div class="input_con">
								<input type="text" class="easyui-validatebox text"
									data-options="required:true,validType:'ip'"
									missingMessage="源主机不能为空!" id="importDatabaseAddress"
									name="importDatabaseAddress" />
							</div></li>
						<li><label for="importPort" class="label">端口号：</label>
							<div class="input_con">
								<input type="text" value="1521" class="easyui-validatebox text"
									data-options="required:true,validType:'port'"
									missingMessage="端口号不能为空!" invalidMessage="端口必须为1~6位数的整数！"
									id="importPort" name="importPort" />
							</div></li>
						<li class="li_col"><label for="importDatabase" class="label">数据库实例：</label>
							<div class="input_con">
								<input type="text" class="easyui-validatebox text"
									data-options="required:true" missingMessage="数据库实例不能为空!"
									id="importDatabase" name="importDatabase" style="width: 335px;" />
							</div></li>
						<li><label for="importUser" class="label">用户名：</label>
							<div class="input_con">
								<input type="text" class="easyui-validatebox text"
									data-options="required:true" missingMessage="用户名不能为空!"
									id="importUser" name="importUser" />
							</div></li>
						<li><label for="importPass" class="label">密码：</label>
							<div class="input_con">
								<input type="password" class="easyui-validatebox text"
									data-options="required:true" missingMessage="密码不能为空!"
									id="importPass" name="importPass" />
							</div></li>
						<li><label for="comboxImportFieldName" class="label">领域：</label>
							<div class="input_con">
								<input id="comboxImportFieldName" name="comboxImportFieldName"
									class="text" />
							</div></li>
						<li><label for="comboxImportSystemName" class="label">系统：</label>
							<div class="input_con">
								<input type="text" name="comboxImportSystemName"
									id="comboxImportSystemName" class="text" />
							</div></li>
					</ul>
				</form>
				<a href="javascript:void(0);" class="default_btn easyui-linkbutton"
					id="importDatabaseBtn" style="margin: 10px auto;">读取</a>
			</div>
		</div>
		<div class="template">
			<div class="import_con">
				<label>文件地址：</label> <input type="text" id="fileName"
					name="fileName" class="text" readonly="readonly" />
				<button class="default_btn" id="selFileBtn" style="display: inline;">浏览</button>
				<input type="file" name="importLinkFile" id="importLinkFile"
					accept=".xls,.xlsx" />
			</div>
			<p style="text-align: center;">
				温馨提示：支持导入的文件格式为.xls和.xlsx<a
					href="../../assets/importDataTempl/DBLINK导入模板.xlsx" class="dl-link">下载DBlink导入模板</a>
			</p>
			<div id="buttons_inport" class="button_con">
				<a href="javascript:void(0)" class="easyui-linkbutton" id="import"
					onclick="startImport()" iconCls="icon-ok" plain="true">确认导入</a>
			</div>
		</div>
	</div>

	<script type="text/javascript" src="/webjars/json3/3.3.2/json3.min.js"></script>
	<script type="text/javascript"
		src="../../js/jquery-easyui-1.4.3/jquery.min.js"></script>
	<script type="text/javascript"
		src="../../js/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
	<script type="text/javascript"
		src="../../js/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="../../js/cook/public.js"></script>
	<script type="text/javascript" src="../../js/cook/constants.js"></script>
	<script type="text/javascript" src="../../js/cook/FormValidate.js"></script>
	<script type="text/javascript" src="../../js/rsa/security.js"></script>
	<script type="text/javascript" src="../../js/rsa/rsaly.js"></script>
	<script type="text/javascript" src="../../js/ajaxfileupload.js"></script>


	<script type="text/javascript"
		src="../../js/cook/LedgerManagement/DBlinkManage.js"></script>

</body>
</html>
